<div class="referbox">
  <div class="rate-toolbar" id="discuss_toolbar">
    <span class="rate-filter">
    <strong><{t}>宝贝评价<{/t}></strong>
    <input id="discuss_hasaddition" class="rate-list-append" type="checkbox" name="append" <{if !!$toolbar.append }>checked=""<{/if}>>
    <label for="discuss_hasaddition">查看追加 (<{$addition.count}>)</label>
    <input id="discuss_hascontent" type="checkbox" <{if !$toolbar.content}>checked=""<{/if}> name="content">
    <label for="discuss_hascontent">有内容评价</label>
    </span>
    <span class="rate-sort">
      <a class="<{if !!$toolbar.orderb && $toolbar.orderb == '1'}>active<{/if}>" data-value="1" href="#" title="按评价时间从近到远进行排序">
      <span class="rate-arrow">按时间</span></a>
    </span>
    <input type='hidden' name="orderb">
  </div>
  <div class="evalubox clearfix">
  <{if $point_status == 'on'}>
    <div class="evalubox-left">
      <div class="scores-wrap">
        <ul class="out">
          <li class="flt">商品评分</li>
          <li><strong><{$goods_point.avg_num|default:'0.0'}></strong></li>
          <li>
            <div class="star-div flt " style="padding-top:2px;padding-top:0\9"><!--咨询页面这个地方class可调用用"star-no"-->
              <ul>
                <li class="star<{$goods_point.avg|default:0}>"></li>
              </ul>
            </div>
            <span class="scores_size"></span>
            </li>
          <li style="clear:both">(<{t}>共<{/t}><span class="value-color"><{$total_point_nums|default:'0'}></span><{t}>人评分<{/t}>)</li>
        </ul>
      </div>
    </div>
	<{/if}>
    <div class="evalubox-right">
      <div class="rightbox" ><!--<h4>评价说明</h4>--><p><{$comment.goods_discuss_notice}></p>
</div>
      <{if false}><div class="floatright"><a href="#write_discuss" class="orangebtn allnum discuss-ask"><span>我要评论</span></a></div><{/if}>
    </div>
  </div>
  <a name="discuss_all_info"></a>
  <div class="goods-discus-title bulelink"> <{t}>共<{/t}><span id="product_discusscount" class="value-color"><{$comment.discussCount|default:'0'}></span><{t}>个用户评价<{/t}>&nbsp;&nbsp;<span class="all_link" style="display:none;"><a href="#discuss_all_info" class="allnum"><{t}>查看所有评论<{/t}></a></span> </div>
<div class="consult-content">
    <div class="consult-panel rate-grid" id="discuss_content"><{include file="site/product/discuss_content.html" app="b2c"}></div>
</div>

 </div>
<{if false}>
  <div style="display:none" class="displaydiv">
<!--  发表评论区域-->
<a name="write_discuss"></a>
<form class="addcomment" method="post" action='<{link app=b2c ctl=site_comment act=toComment arg0=$goods.goods_id arg1=discuss}>' onsubmit='checkFormReqs(event);'>
      <div class="review-box">
      <h4 class="review-title"><{t}>发表评论<{/t}></h4>
<div class="division clearfix">
      <div <{if $discuss_status}>class="leftbox"<{else}>class="leftbox message-login"<{/if}> >
      <div class="review-textarea">
      <ul>
      <li>
	  <{if $point_status == 'on'}>
      	<div class="start-point" style=""><!--咨询页面这个class可以调用"nodisplay"-->

	          <{foreach from=$comment_goods_type item=comment_goods_type}>
	          <div class="clearfix">
				<div class="span-2 textright">
				<label><{$comment_goods_type.name}>:</label>
				</div>
				<div id="rate_<{$comment_goods_type.type_id}>" class="star-point-items span-auto">
					<div class="b" style="left:0px;">&nbsp;</div>
					<div class="f">&nbsp;</div>
				</div>
				<div class="span-auto font11px" style="color:orange;font-weight:bold;">5
				</div>
				<input type='hidden' name="point_type[<{$comment_goods_type.type_id}>][point]"/>
			   </div>
	          <{/foreach}>
	     </div>
		 <{/if}>
      </li>
        <{if $discuss_status}>
             <li>
             <{assign var="placeholder" value="欢迎发表评论（最多1000字）"}>
        <{else}>
             <li class="message-login">
             <{assign var="disb" value="true"}>
             <p><{$discuss_message}></p>
        <{/if}>
    	<{input type="textarea" class="x-input inputstyle font12px db mb5"  disabled=$disb placeholder=$placeholder vtype="sendcomments" rows="5" name="comment" style="width:97%"}></li>

          <{if $login eq "nologin"}>
        <li><{t}>联系方式：<{/t}> <{input type="text" vtype=required class="inputstyle"  disabled=$disb size=20 name="contact"}><span class="infotips"><{t}>(可以是电话、email、qq等).<{/t}></span></li>
          <{/if}>
          <{if $discussshow == "on"}>
          <!--
            <li><{t}>验证码：<{/t}>
            <{input type="text" vtype=required size="4" maxlength="4" name="discussverifyCode"}>&nbsp;<img src="<{link app="b2c" ctl="site_comment" act="gen_dissvcode" arg0=$smarty.now}>" align="absmiddle" id="discussimgVerifyCode"/><a href="javascript:changeimg('discussimgVerifyCode','discuss')">&nbsp;<{t}>看不清楚?换个图片<{/t}></a>
        </li> -->
            <li><{t}>验证码:  <{/t}><{input type="text" vtype=required size="4" disabled=$disb maxlength="4" class="showdisaskvcode" name="discussverifyCode" onfocus="changeimg('discussimgVerifyCode','discuss');"}>&nbsp;<img align="absmiddle" id="discussimgVerifyCode" style="display:none;" codesrc="<{link app="b2c" ctl="site_comment" act="gen_dissvcode"}>"/><a  onclick="javascript:changeimg('discussimgVerifyCode','discuss');" class="no-unl">&nbsp;<{t}>点击更换新图片<{/t}></a><span></span></li>
          <{/if}>
            <{if $login != "nologin"}>
            <li><input type="text" name="" style="display:none" />
              <label for="publish"><{t}>匿名发表:<{/t}></label>
              <input type="checkbox" id="publish" name="hidden_name" value="YES"/>
            </li>
            <{/if}>
            <input type="hidden" name="filter" value=<{$filter}>>
            <li style="padding-left:0">
            <{if ($discuss_status == '') && ($login =='nologin' || $discuss_message != '' )}>
                 <button type="button" class="btn" disabled><span><span><{t}>提交评论<{/t}></span></span></button>
            <{else}>
                 <button id="product-discuss-submitBtn" type="submit" rel="_request" data-ajax-config="{update:$$('[data-sync-type=goodsdiscuss]')[0], onComplete:function(){if((/text\/jcmd/).test(this.getHeader('Content-type'))) {return;}Message.success('<{$submit_msg}>');$$('.discuss-ask').getParent('.pdtdetail').getElement('.displaydiv').show();$$('[data-tab-type=goodsdiscuss]')[0]&&$$('[data-tab-type=goodsdiscuss]')[0].getElement('em').set('html',$('product_discusscount').get('html'));}}" class="btn"><span><span><{t}>提交评论<{/t}></span></span></button>
            <{/if}>
            </li>
      </ul>
      </div>

      </div>
      <div class="rightbox"><p><{$comment.submit_comment_notice.discuss}></p>
</div>
        <div class="clear"></div>
      </div>
      </div>
    </form>
</div>
<{/if}>
<!-- 回复 -->
<div id="comment_html" class="<{if $discuss_status}>repay-box<{else}>repay-box discussfloat<{/if}>" style="display:none;">
    <div class="lt"></div>
    <div class="rt"></div>
    <div class="lb"></div>
    <div class="rb"></div>
    <div class="arrw"></div>
    <form method="post" onsubmit='checkFormReqs(event);'>
      <div class="review-textarea">
        <ul>
          <li class="message-login" id="repay_textarea">
          <{if $discuss_status}>
          <{assign var="placeholder" value="欢迎发表评论（最多1000字）"}>
          <{else}>
          <{assign var="disb" value="true"}>
          <p><{$discuss_message}></p>
          <{/if}>
          <{input type="textarea" class="x-input inputstyle font12px db mb5"  disabled=$disb placeholder=$placeholder vtype="sendcomments&&required" rows="5" name="comment" style="display:block;width:98%;"}>
          <div class="infotips" align="right"><span class="price1">0</span>/1000</div>
          </li>
          <{if $login eq "nologin"}>
          <li><{t}>联系方式:<{/t}><{input type="text" disabled=$disb required="true" size=20 name="contact"}><span class="infotips"><{t}>(可以是电话、email、qq等)<{/t}></span>
          </li>
          <{else}>
          <li><input type="text" name="" style="display:none" />
          <input type="checkbox" name="hidden_name" value="YES"/>
          匿名发表</li>
          <{/if}>
          <{if $discussshow == "on"}>
          <li><{t}>验证码：<{/t}><{input type="text" style=" width:70px" disabled=$disb vtype=required size="4" maxlength="4" class="showvcode" name="replyverifyCode" onfocus="changereplyimgtt(this);"}>&nbsp;<img style="display:none" codesrc="<{link app="b2c" ctl="site_comment" act="gen_replyvcode"}>"/><a href="javascript:void(0);" onclick="changereplyimg(this);"class="link-blue">&nbsp;<{t}>点击更换新图片<{/t}></a><span></span></li>
          <{/if}>
          <li style="padding-left:0">

          <{if ($discuss_status == '') && ($login =='nologin' || $discuss_message != '' )}>
              <button class="btn" rel="_request" disabled> <span><span> <{t}>提 交<{/t}></span></span> </button>
          <{else}>
              <button id="cart-coupon-submitBtn" class="btn" type="submit" rel="_request" data-ajax-config="{update:$$('[data-sync-type=goodsdiscuss]')[0], onComplete:function(){if((/text\/jcmd/).test(this.getHeader('Content-type'))) {return;}Message.success('发表成功');$$('.discuss-ask').getParent('.pdtdetail').getElement('.displaydiv').show();}}"> <span><span> <{t}>提 交<{/t}></span></span> </button>
          <{/if}>

          <span style="cursor:pointer" class="link-blue" onclick="cancle();">取消回复</span>
          </li>
        </ul>
      </div>
    </form>
  </div>

	 <script>

		window.addEvent('domready',function(){
            $$('.consult-panel').addEvent('click',function(e){
                //this.hide();
        if(!$(e.target).hasClass('repay_span'))return;
        if($('new_repay_box'))
        $('new_repay_box').destroy();
        var replay_div = '';
        var replay_form = '';
        var textValue = '';
        var repayTextarea = '';

        if($(e.target).hasClass('ask-btn')){
          replay_div = $('ask_html').clone().show();
          textValue = "欢迎咨询（最多1000字）";
        }
        else if($(e.target).hasClass('comment-btn')){
          replay_div = $('comment_html').clone().show();
          textValue = "欢迎发表评论（最多1000字）";

        }
        replay_form = replay_div.getElement('form');
        new Request({
          url:'<{link app="b2c" ctl="site_comment" act="reply_link"}>',
          onComplete:function(response){
            replay_form.action = response;
            var el =replay_div.getElement('textarea') ;
            if(!('placeholder' in document.createElement('input'))) {
              el.setStyles({'fontSize':'12px','color':'#999'});
              el.value = textValue;
              el.addEvent('focus',function(e){
                if($(e.target).value  === $(e.target).get('placeholder')){
                  el.setStyle('color','#000');
                  $(e.target).value = '';
                }
              });
            };

            el.addEvent('keyup',function(e){
              var limitNum = 1000;
              var _parent = $('new_repay_box');
              if($(e.target).value.length > limitNum) $(e.target).value = $(e.target).value.substring(0,limitNum);
              _parent.getElement('.price1').set('text',$(e.target).value.length);
            });

          }
        }).post('comment_id='+$(e.target).id);
        replay_div.setProperty('id','new_repay_box');
        replay_div.inject($(e.target).getParent('div'),'after');
      });

        $$('.showdisaskvcode').addEvent('focus',function(){
            if (this.retrieve('showdisaskvcode',false)) return;
            var vcodeImg = this.getNext('img');
            vcodeImg.src = vcodeImg.get('codesrc')+'?'+(+new Date());
            vcodeImg.show();
            this.store('showdisaskvcode',true);
        });

		$$('.showdisaskvcode').fireEvent('focus');

        $$('.consult-panel').addEvent('click',function(e){
            if(!$(e.target).hasClass('showvcode'))return;
            if ($(e.target).retrieve('showvcode',false))return;
            var vcodeImg = $(e.target).getNext('img');
            vcodeImg.src = vcodeImg.get('codesrc')+'?'+(+new Date());
            vcodeImg.show();
            $(e.target).store('showvcode',true);
        });

            $$('.discuss-ask').addEvent('click',function(e){
                this.getParent('.pdtdetail').getElement('.displaydiv').show();
            });

			$$('.star-point-items').each(function(i){
					var _c = i.getNext();
					var _b = i.getElement('.b');
					var _f = i.getElement('.f');
					var _ipt = i.getNext('input');
					var fenshu = 	_ipt.value = 5;
					i.addEvents({
							'mousemove':function(e){
								var offset = (e.page.x - i.getPosition([document.body]).x);
								var _left = (offset-i.offsetWidth).limit(0-i.offsetWidth,0);
								var count  = (5*((i.offsetWidth + _left)/(i.offsetWidth)));
									if(count<0.3){count  = 0}else{count = Math.ceil(count);}
								_b.setStyle('left',i.offsetWidth*(count/5) - i.offsetWidth);
								_c.set('text',fenshu = count);
							},
							'mouseenter':function(e){
								this.fireEvent('mousemove',e);
                            },
                            'mouseout':function(e){
                                fenshu = _ipt.value?_ipt.value:5;
                                _b.setStyle('left',i.offsetWidth*(fenshu/5) - i.offsetWidth);
                                _c.set('text',fenshu);
                            },
            'click':function(e){
              _ipt.value = fenshu;
            }
					});
					/*fix png*/
					if(Browser.ie6){
						_f.setStyles({
							'filter':'progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=image, src='+_f.getStyle('background-image').match(/url\(([^\)]*)/)[1]+')',
							'background':'none'
						});
					}
			});

      var obj = $('discuss_toolbar')||'';
      if(obj){
        var inputs = obj.getElements('input')||[];
        var as = obj.getElements('a')||[];
        var oHidden = obj.getElement('input[type^=hidden]')||'';
        var aActive = obj.getElement('a[class^=active]')||'';
        if(inputs){
          inputs.removeEvents('click').addEvent('click',function(e){
            if(oHidden && aActive) oHidden.set('value',aActive.get('data-value'));
            new Request.HTML({
              url:'<{link app=b2c ctl=site_product act=comment_filter arg=$goods.goods_id }>',
              update:$$('[data-sync-type=goodsdiscuss]')[0],
              method:'post',
              data:obj,
              onComplete:function(){
                if((/text\/jcmd/).test(this.getHeader('Content-type'))) {return;}
                $$('.discuss-ask').getParent('.pdtdetail').getElement('.displaydiv').show();
              }
            }).send();
          });
          as.removeEvents('click').addEvent('click',function(e){
            aActive.removeClass('active');
            this.addClass('active');
            if(oHidden && aActive) oHidden.set('value',this.get('data-value'));
            new Request.HTML({
              url:'<{link app=b2c ctl=site_product act=comment_filter arg=$goods.goods_id }>',
              update:$$('[data-sync-type=goodsdiscuss]')[0],
              method:'post',
              data:obj,
              onComplete:function(){
                if((/text\/jcmd/).test(this.getHeader('Content-type'))) {return;}
                $$('.discuss-ask').getParent('.pdtdetail').getElement('.displaydiv').show();
              }
            }).send();
            return false;
          });
        }
      }
		});
	</script>
